package com.oocl.o2o.admin.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.oocl.o2o.admin.entity.Manager;
import com.oocl.o2o.admin.service.ManagerService;

/**
 * 
 * 管理员  前台页面的判空
 *
 */
@Controller
public class ManagerController {
	
	@Resource(name="managerServiceImpl")
	private ManagerService managerService;
	
	
	@PostMapping(name="/manager")
	public String login(Manager manager,HttpSession httpSession){
		System.out.println("ManagerController........");
		Manager m=managerService.findByUnameAndPassword(manager.getUname(), manager.getPassword());
		if (m!=null) {
			httpSession.setAttribute("manager", m);
			return "redirect:/sec/home.jsp"; 
		}else{
			return "login";
		}
	}
	
}
